<template>
  <div>
    <table align="center" width="400px" border="1">
      <tr align="center">
        <td colspan="2">{{ edite.title }}</td>
      </tr>
      <tr v-for="(v,k,index) in edite.params" :key="index">
        <td>{{ k }}</td>
        <td>{{ v }}</td>
      </tr>
    </table>
    <div align="center">
      <div id="ss">
        是否同意
        <van-radio-group v-model="radio">
          <van-radio name="1">同意</van-radio>
          <van-radio name="2">不同意</van-radio>
        </van-radio-group>
        <van-field label="审批意见:" v-model="text"/>
      </div>

      <van-button @click="submit">审批</van-button>
    </div>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: 'apply_for1',
  data() {
    return {
      eid: this.$route.query.id,
      edite: {},
      radio: 1,
      text: '',
      uid: localStorage.getItem('uid'),
      username: localStorage.getItem('username'),
    }
  },
  methods: {
    getlist() {
      axios.get('/examineone?eid=' + this.eid).then(res => {
        console.log(res);
        this.edite = res.data.list
      })
    },
    submit() {
      axios.post('/taskrecordM', {
        'userid': this.uid, 'eid': this.eid, 'username': this.username,
        'text': this.text, 'radio': this.radio
      }).then(res => {
        console.log(res);
      })
    }
  },
  mounted() {
    this.getlist()
  }
}
</script>

<style>
#ss {
  width: 350px;
}
</style>
